# -*- coding: utf-8 -*-
"""
Created on Fri Oct  2 20:31:09 2020

Elevator sim

@author: dalaska
"""

# https://python3-cookbook.readthedocs.io/zh_CN/latest/c12/p03_communicating_between_threads.html
# https://www.jianshu.com/p/5da50563bf10


# evalator
# cart
# move
# buttom
# request
import numpy as np

class elevator():
    """
    elevator class
    """
    def __init__(self,floor):
        self.request_list =[]
        self.current_floor = floor
    def get_request(self):
        """
        add floor to request list
        """
        str = input("请输入：")
        self.request_list.append(int(str))
    def get_buttompress(self)
        """
        get keyboard input
        """
        # TODO
        pass
    
    def check_request(self):
        """
        choose the destination floor
        """
        self.dest_floor = 5
    def go(self):
        """
        go to the destination floor, 
        move one floor in one cycle
        """
        if (self.current_floor - self.dest_floor) > 0 :
            self.current_floor = self.current_floor - 1
        elif (self.current_floor - self.dest_floor) < 0 :
            self.current_floor = self.current_floor + 1  
        return self.current_floor
    def which_floor(self):
        """
        show which floor, the elevator is on
        """
        print(self.current_floor,self.dest_floor,self.request_list)
    def run(self):
        print('elevator start\ncurrent floor, dest floor, request list')
        self.get_request()
        self.check_request()
        self.go()
        self.which_floor()



if __name__ == "__main__":
    elev1 = elevator(10)
    elev1.run()
    pass